package cn.zh.planmanager.domain.plan.model.entity;

import cn.zh.planmanager.infrastructure.common.Entity;
import lombok.Data;
import lombok.Getter;

import java.time.LocalDate;

/**
 * @author zh
 */
@Data
public class PlanSet implements Entity<Integer> {

    private Integer id;

    private String name;

    private LocalDate time;

    private Integer status;

    public void approve(){
        this.status = ApprovalStatusEnum.APPROVE.getCode();
    }

    public void reject(){
        this.status = ApprovalStatusEnum.REJECT.getCode();
    }

    @Override
    public boolean sameAsId(Integer id) {
        return this.id.equals(id);
    }

    @Getter
    public enum ApprovalStatusEnum {

        /**
         * 批准
         */
        APPROVE(0),
        /**
         * 拒绝
         */
        REJECT(1)
        ;

        private final Integer code;

        ApprovalStatusEnum(Integer code){
            this.code = code;
        }
    }
}
